package com.sicau.socialpracticesystem.entity.vo.prize;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * <p>
 * 奖品查询结果
 * </p>
 *
 * @author sxt && ttxxi
 * @since 2021-04-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("prize")
@ApiModel(value = "PrizeVO", description = "奖品查询结果")
public class PrizeVO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "奖品名称")
    private String priceName;

    @ApiModelProperty(value = "需要的积分")
    private Double needPoints;

    @ApiModelProperty(value = "奖品数量")
    private Long prizeNumber;

    @ApiModelProperty(value = "已兑换数量")
    private Long exchangedNumber;

    @ApiModelProperty(value = "是否上架兑换(0: 否, 1: 是)")
    private Integer onExchanging;

    @TableField(exist = false)
    @ApiModelProperty(value = "剩余数量")
    private Long leftNumber;

    public Long getLeftNumber() {
        return prizeNumber - exchangedNumber;
    }
}
